/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.hk.sys.entity.adv;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.thinkgem.jeesite.common.persistence.TreeEntity;
import org.hibernate.validator.constraints.Length;

import java.util.List;

import com.google.common.collect.Lists;

import com.thinkgem.jeesite.common.persistence.DataEntity;

/**
 * 乐看系统分类Entity
 *
 * @author 罗天文
 * @version 2018-04-19
 */
public class HkCategory extends TreeEntity<HkCategory> {

    private static final long serialVersionUID = 1L;
    private HkCategory parent;        // 父级编号
    private String parentIds;        // 所有父级编号

    private String type;        // 类型
    private String code;        // 编码
    private String level;        // 级别
    private String imgSrc;        // 图片地址
    private String imgRank;        // 图片序号
    private String labelColor;  //标签颜色
    private List<HkCategoryQuery> hkCategoryQueryList = Lists.newArrayList();        // 子表列表

    public HkCategory() {
        super();
    }

    public HkCategory(String id) {
        super(id);
    }

    @JsonBackReference
    public HkCategory getParent() {
        return parent;
    }

    public void setParent(HkCategory parent) {
        this.parent = parent;
    }


    public void setParentIds(String parentIds) {
        this.parentIds = parentIds;
    }


    @Length(min = 0, max = 1, message = "类型长度必须介于 0 和 1 之间")
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }


    @Length(min = 0, max = 20, message = "编码长度必须介于 0 和 20 之间")
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Length(min = 0, max = 11, message = "级别长度必须介于 0 和 11 之间")
    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    @Length(min = 0, max = 200, message = "图片地址长度必须介于 0 和 200 之间")
    public String getImgSrc() {
        return imgSrc;
    }

    public void setImgSrc(String imgSrc) {
        this.imgSrc = imgSrc;
    }

    @Length(min = 0, max = 11, message = "图片序号长度必须介于 0 和 11 之间")
    public String getImgRank() {
        return imgRank;
    }

    @Length(min = 0, max = 32, message = "标签颜色长度必须介于 0 和 11 之间")
    public String getLabelColor() {
        return labelColor;
    }

    public void setLabelColor(String labelColor) {
        this.labelColor = labelColor;
    }

    public void setImgRank(String imgRank) {
        this.imgRank = imgRank;
    }

    public String getParentId() {
        return parent != null && parent.getId() != null ? parent.getId() : "0";
    }

    public List<HkCategoryQuery> getHkCategoryQueryList() {
        return hkCategoryQueryList;
    }

    public void setHkCategoryQueryList(List<HkCategoryQuery> hkCategoryQueryList) {
        this.hkCategoryQueryList = hkCategoryQueryList;
    }
}